package com.ruoyi.framework.task;

import com.ruoyi.project.red.service.IRedCaptchaService;
import com.ruoyi.project.red.service.IRedUserService;
import com.ruoyi.project.red.service.impl.RedCaptchaServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("myTask")
public class MyTask {
    @Autowired
    private IRedCaptchaService redCaptchaService;

    @Autowired
    private IRedUserService redUserService;
    /*
     * 1.清除所有已经失效的验证码 CAPTCHA
     * 2.清除所有已经失效的用户token
     */
    public void deleteTokenAndCaptcha()
    {
        redCaptchaService.deleteRedCaptchaTimeOut();
        System.out.println("删除超时验证码缓存");
        redUserService.deleteRedUserOutTime();
        System.out.println("删除人员缓存");
        //System.out.println("执行无参方法");
    }
}
